{% extends "base.html" %}
{% block head %}
<style type="text/css">
	.cke_skin_v2{
	}
	#mainContent{
		margin-right:300px;
	}
	#mainContent .titleWrap .title{
		width:100%;
		height:30px;
		padding:2px 5px;
		-moz-box-sizing: border-box;
		-webkit-box-sizing: border-box;
		box-sizing: border-box;
	}
	#secondContent{
		width:270px;
		float:right;
		padding-top:50px;
	}
	.submitBlock,.categBlock{
		width:260px;
		margin-bottom:10px;
	}
	.categBlock input{
		margin-right:4px;
	}
</style>
<script type="text/javascript" src="/static/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/static/ckfinder/ckfinder.js"></script>
<script type="text/javascript">	
$(function(){
		var editor = CKEDITOR.replace( 'postContent');
		

})
var editPostSumbit = function()
{
	var editForm = $('#editPost');
	editForm.submit();
}
</script>
{% endblock %}

{% block contentWrap %}
<form action="/admin/editPost?id={{post.id}}" method="post" id="editPost">
<input type="hidden" name="submitType" id="submitType" />
<div id="secondContent">
	<div class="block_mod submitBlock">
		<div class="header">发布</div>
		<div class="content">	
			{% if post.isPosted==1 %}
				<input type="button" value="更新" class="submit" onclick="$('#submitType').val('update');editPostSumbit();">
			{% endif %}
			{% if post.isPosted==0 %}
				<input type="button" value="发布" class="submit" onclick="$('#submitType').val('release');editPostSumbit();">
				<input type="button" value="保存草稿" class="draft" onclick="$('#submitType').val('saveToDraft');editPostSumbit();">
			{% endif %}
			<input type="button" value="预览" class="preview">
		</div>
	</div>
	<div class="block_mod categBlock">
		<div class="header">分类</div>
		<div class="content">
			<ul>
				{% for categ in categs %}
					{% if post.categId==categ.id %}
					<li><input type="radio" name="categId" value="{{categ.id}}" checked="checked" id="categ{{categ.id}}"/><label for="categ{{categ.id}}">{{categ.name}}</label></li>
					{% else %}
					<li><input type="radio" name="categId" value="{{categ.id}}" id="categ{{categ.id}}"/><label for="categ{{categ.id}}">{{categ.name}}</label></li>
					{% endif %}
				{% endfor %}
			</ul>
		</div>
	</div>
</div>
	<div id="mainContent">
	<h2>文章</h2>
		标题：
		<div class="titleWrap"><input type="text" name="title" class="title" value="{{post.title}}"/></div>
		内容：
		<textarea name="content" id="postContent" cols="30" rows="10">{{post.content}}</textarea>
	</div>
</form>
{% endblock %}
